#include<iostream>
#include<vector>
#include<queue>
#include<cstring>
#include<cmath>
#include<map>
#include<set>
#include<cstdio>
#include<algorithm>
#define debug(a) cout<<#a<<"="<<a<<endl;
using namespace std;
const int maxn=1e5;
typedef long long LL;
inline LL read()
{
	LL x=0,f=1;char ch=getchar();
	while (!isdigit(ch)){if (ch=='-') f=-1;ch=getchar();}
	while (isdigit(ch)){x=x*10+ch-48;ch=getchar();}
	return x*f;
}
int main(void)
{
  cin.tie(0);std::ios::sync_with_stdio(false);
  LL t;cin>>t;
  while(t--){
    string a;cin>>a;
    LL sum=0;LL pos1=-1;LL pos2=-1;
    for(LL i=0;i<a.size();i++){
        if(a[i]=='(') pos1=i;
        if(a[i]==')') pos2=i;
    }
    if(pos1<pos2){
        for(LL i=0;i<a.size();i++){
            if(a[i]=='?') sum++;
        }
        if(sum&1) cout<<"NO"<<endl;
        else cout<<"YES"<<endl;
    }
    else{
        for(LL i=0;i<a.size();i++){
            if(a[i]=='?') sum++;
        }
        if(sum&1) cout<<"NO"<<endl;
        else{
       ///     debug(pos1);debug(pos2);
            LL flag1=0;LL flag2=0;
            for(LL i=0;i<pos2;i++){
                if(a[i]=='?') flag1=1;
            }

            for(LL i=pos1;i<a.size();i++){
                if(a[i]=='?') flag2=1;
            }
            if(flag1&&flag2){
                cout<<"YES"<<endl;
            }
            else cout<<"NO"<<endl;
        }
    }
  }
return 0;
}
